<!-- $Id: article_info.htm 16780 2009-11-09 09:28:30Z sxc_shop $ -->
{include file="pageheader.htm"}
{insert_scripts files="../js/utils.js,selectzone.js,validator.js"}
<script type="text/javascript" src="../data/assets/js/calendar.php?lang={$cfg_lang}"></script>
<link href="../data/assets/js/calendar/calendar.css" rel="stylesheet" type="text/css" />
<!-- start goods form -->
<div class="tab-div">
  <div id="tabbar-div">
    <p>
      <span class="tab-front" id="general-tab">项目信息</span>
      <span class="tab-back" id="company-tab">企业信息</span>
	  <span class="tab-back" id="detail1-tab">项目介绍</span>
      <span class="tab-back" id="detail2-tab">加盟流程</span>      
	  <!-- <span class="tab-back" id="goods-tab">{$lang.tab_goods}</span> -->
    </p>
  </div>

  <div id="tabbody-div">
    <form  action="project.php" method="post" enctype="multipart/form-data" name="theForm" onsubmit="return validate();">
    <table width="90%" id="general-table">
      <tr>
        <td class="narrow-label">{$lang.title}</td>
        <td><input type="text" name="title" size ="40" maxlength="60" value="{$project.title|escape}" />{$lang.require_field}</td>
      </tr>
	  <tr>
        <td class="narrow-label">{$lang.project_money}</td>
        <td>              
			  <select name="start_money">
              <option value="不限">请选择投资金额</option>
              <option value="1-5万" {if $project.start_money eq '1-5万'}selected{/if}>1-5万</option>
              <option value="5-10万" {if $project.start_money eq '5-10万'}selected{/if}>5-10万</option>
			  <option value="10-20万" {if $project.start_money eq '10-20万'}selected{/if}>10-20万</option>
			  <option value="20-50万" {if $project.start_money eq '20-50万'}selected{/if}>20-50万</option>
			  <option value="50-100万" {if $project.start_money eq '50-100万'}selected{/if}>50-100万</option>
			  <option value="100万以上" {if $project.start_money eq '100万以上'}selected{/if}>100万以上</option>
            </select>
        </td>
      </tr>      
      <!-- {if $project.cat_id >= 0} -->
      <tr>
        <td class="narrow-label">所属行业</td>
        <td>
          <select name="project_cat" onchange="catChanged()">
            <option value="0">{$lang.select_plz}</option>
            {$cat_select}
          </select>
         {$lang.require_field}</td>
      </tr>
      <!-- {else} -->
      <input type="hidden" name="project_cat" value="-1" />
      <!-- {/if} -->
      {if $project.cat_id >= 0}
      <tr>
        <td class="narrow-label">{$lang.project_type}</td>
        <td><input type="radio" name="project_type" value="0" {if $project.project_type eq 0}checked{/if}>{$lang.common}
      <input type="radio" name="project_type" value="1" {if $project.project_type eq 1}checked{/if}>{$lang.top}
        {$lang.require_field}        </td>
      </tr>
      <tr>
        <td class="narrow-label">{$lang.is_open}</td>
        <td>
        <input type="radio" name="is_open" value="1" {if $project.is_open eq 1}checked{/if}> {$lang.isopen}
      <input type="radio" name="is_open" value="0" {if $project.is_open eq 0}checked{/if}> {$lang.isclose}{$lang.require_field}        </td>
      </tr>
      {else}
      <tr style="display:none">
      <td colspan="2"><input type="hidden" name="project_type" value="0" /><input type="hidden" name="is_open" value="1" /></td>
      </tr>
      {/if}
      <tr style="display:none">
        <td class="narrow-label">{$lang.author}</td>
        <td><input type="text" name="author" maxlength="60" value="{$project.author|escape}" /></td>
      </tr>
	  <tr style="display:none">
        <td class="narrow-label">发布企业</td>
        <td>			
              <select name="user_id">
			  <option value="0">{$lang.select_please}</option>
			  {foreach from=$user_list item=user}
			  <option value="{$user.user_id}_{$user.user_name}" {if $user.user_id eq $project.user_id}selected{/if}>{$user.user_name}</option>
			  {/foreach}	
			  </select>
        </td>
      </tr>
      <tr style="display:none;">
        <td class="narrow-label">{$lang.email}</td>
        <td><input type="text" name="author_email" maxlength="60" value="{$project.author_email|escape}" /></td>
      </tr>
      <tr style="display:none;">
        <td class="narrow-label">{$lang.keywords}</td>
        <td><input type="text" name="keywords" maxlength="60" value="{$project.keywords|escape}" /></td>
      </tr>
      <tr style="display:none;">
        <td class="narrow-label">{$lang.lable_description}</td>
        <td><textarea name="description" id="description" cols="40" rows="5">{$project.description|escape}</textarea></td>
      </tr>
      <tr style="display:none;">
        <td class="narrow-label">{$lang.external_links}</td>
        <td><input name="link_url" type="text" id="link_url" value="{if $project.link neq ''}{$project.link|escape}{else}http://{/if}" maxlength="60" /></td>
      </tr>
	  <tr>
        <td class="narrow-label">浏览人数</td>
        <td><input type="text" name="click_count" maxlength="60" value="{$project.click_count|escape}" /></td>
      </tr>
	  <tr>
        <td class="narrow-label">意向人数</td>
        <td><input type="text" name="join_count" maxlength="60" value="{$project.join_count|escape}" /></td>
      </tr>
      <tr>
        <td class="narrow-label">联系电话</td>
        <td><input type="text" name="com_phone" maxlength="60" value="{$project.com_phone|escape}" /></td>
      </tr>
      <tr>
        <td class="narrow-label">封面图片</td>
        <td><input type="file" name="file"><br>
            <img src="../{$project.file_url}" width="400px"/>
      </td>
      </tr>
    </table>
    
    <table width="90%" id="company-table" style="display:none">
      <tr>
        <td class="narrow-label">公司名称</td>
        <td><input type="text" name="com_name" size ="40" maxlength="60" value="{$project.com_name|escape}" /></td>
      </tr>	  
      <tr>
        <td class="narrow-label">公司地址</td>
        <td>
              <input type="text" name="com_address" size ="40" maxlength="60" value="{$project.com_address|escape}" /></td>
      </tr> 	  
	  <tr>
        <td class="narrow-label">经营范围</td>
        <td><input name="com_range" type="text" value="{$project.com_range}" maxlength="60" /></td>
      </tr>
      <tr>
        <td class="narrow-label">成立时间</td>
        <td><input name="com_birthday" type="text" value="{$project.com_birthday}" maxlength="60" /></td>
      </tr>	
	  <tr>
        <td class="narrow-label">营业执照</td>
        <td><input type="file" name="com_pic"><br>
          <img src="../{$project.com_pic}" width="400px"/>
        </td>
      </tr>	
    </table>

    <table width="90%" id="detail1-table" style="display:none">
     <tr><td>{$fckeditor1}</td></tr>
    </table>
	<table width="90%" id="detail2-table" style="display:none">
     <tr><td>{$fckeditor2}</td></tr>
    </table>
    
    <div class="button-div">
      <input type="hidden" name="act" value="{$form_action}" />
      <input type="hidden" name="old_title" value="{$project.title}"/>
      <input type="hidden" name="id" value="{$project.project_id}" />
	  <input type="hidden" name="file_url" value="{$project.file_url}" />
	  <input type="hidden" name="com_pic" value="{$project.com_pic}" />
      <input type="submit" value="{$lang.button_submit}" class="button"  />
      <input type="reset" value="{$lang.button_reset}" class="button" />
    </div>
    </form>
  </div>

</div>
<!-- end goods form -->
<script language="JavaScript">

var projectId = {$project.project_id|default:0};
var elements  = document.forms['theForm'].elements;
var sz        = new SelectZone(1, elements['source_select'], elements['target_select'], '');

{literal}
onload = function()
{
  // 开始检查订单
  startCheckOrder();
}

function validate()
{
  var validator = new Validator('theForm');
  validator.required('title', no_title);
{/literal}
{if $project.cat_id >= 0}
  validator.isNullOption('project_cat',no_cat);
{/if}
{literal}

  return validator.passed();
}

document.getElementById("tabbar-div").onmouseover = function(e)
{
    var obj = Utils.srcElement(e);

    if (obj.className == "tab-back")
    {
        obj.className = "tab-hover";
    }
}

document.getElementById("tabbar-div").onmouseout = function(e)
{
    var obj = Utils.srcElement(e);

    if (obj.className == "tab-hover")
    {
        obj.className = "tab-back";
    }
}

document.getElementById("tabbar-div").onclick = function(e)
{
    var obj = Utils.srcElement(e);

    if (obj.className == "tab-front")
    {
        return;
    }
    else
    {
        objTable = obj.id.substring(0, obj.id.lastIndexOf("-")) + "-table";

        var tables = document.getElementsByTagName("table");
        var spans  = document.getElementsByTagName("span");

        for (i = 0; i < tables.length; i++)
        {
            if (tables[i].id == objTable)
            {
                tables[i].style.display = (Browser.isIE) ? "block" : "table";
            }
            else
            {
                tables[i].style.display = "none";
            }
        }
        for (i = 0; spans.length; i++)
        {
            if (spans[i].className == "tab-front")
            {
                spans[i].className = "tab-back";
                obj.className = "tab-front";
                break;
            }
        }
    }
}

function showNotice(objId)
{
    var obj = document.getElementById(objId);

    if (obj)
    {
        if (obj.style.display != "block")
        {
            obj.style.display = "block";
        }
        else
        {
            obj.style.display = "none";
        }
    }
}

function searchGoods()
{
    var elements  = document.forms['theForm'].elements;
    var filters   = new Object;

    filters.cat_id = elements['cat_id'].value;
    filters.brand_id = elements['brand_id'].value;
    filters.keyword = Utils.trim(elements['keyword'].value);

    sz.loadOptions('get_goods_list', filters);
}
{/literal}

/**
 * 选取上级分类时判断选定的分类是不是底层分类
 */
function catChanged()
{
  var obj = document.forms['theForm'].elements['project_cat'];

  cat_type = obj.options[obj.selectedIndex].getAttribute('cat_type');
  if (cat_type == undefined)
  {
    cat_type = 1;
  }

  if ((obj.selectedIndex > 0) && (cat_type == 2 || cat_type == 4))
  {
    alert(not_allow_add);
    obj.selectedIndex = 0;
    return false;
  }

  return true;
}
</script>
{include file="pagefooter.htm"}